/**
 * Created by yuris on 21.01.15.
 */
package InterfaceObjects.BottomPanel {
import InterfaceObjects.ButtonNavigation;
import InterfaceObjects.ButtonSmall;

import com.greensock.TweenMax;
import com.greensock.easing.Back;
import com.greensock.easing.Bounce;
import com.greensock.easing.Quad;

import feathers.controls.Button;
import feathers.controls.ScrollBar;
import feathers.controls.ScrollContainer;
import feathers.display.Scale3Image;
import feathers.layout.HorizontalLayout;
import feathers.textures.Scale3Textures;

import flash.geom.Point;

import starling.display.Image;
import starling.display.Sprite;
import starling.events.Event;
import starling.filters.ColorMatrixFilter;

public class BottomPanel extends Sprite {
    private var _panelTexture:Scale3Textures;
    private var _panelImage:Scale3Image;

    private var _scrollContainer:ScrollContainer;
    private var _buttonsAsset_simulation:Vector.<Button>;
    private var _buttonsAsset_interior:Vector.<Button>;


    private var _warehouseItems:Vector.<WarehouseItem> = new Vector.<WarehouseItem>();
    private var _closeButton:ButtonSmall;


    private const DEFAULT_PANEL_WIDTH:int = 762;
    public static const EVENT_BUTTON_TRIGGERED:String = "EVENT_BUTTON_TRIGGERED";
    public static const EVENT_AVATAR_ATLAS_CREATED:String = "EVENT_AVATAR_ATLAS_CREATED";

    public static const BUTTON_SHOP:String = "BUTTON_SHOP";
    public static const BUTTON_WAREHOUSE:String = "BUTTON_WAREHOUSE";
    public static const BUTTON_INTERIOR:String = "BUTTON_BUILD";
    public static const BUTTON_SIMULATION:String = "BUTTON_SIMULATION";
    public static const BUTTON_BUILD_OBJECT:String = "BUTTON_BUILD_OBJECT";
    public static const BUTTON_PAINT_FLOOR:String = "BUTTON_PAINT_FLOOR";
    public static const BUTTON_PAINT_WALL:String = "BUTTON_PAINT_WALL";
    public static const BUTTON_DOORS:String = "BUTTON_DOORS";
    public static const BUTTON_WALL_COVERS:String = "BUTTON_WALL_COVERS";
    public static const BUTTON_CLOSE:String = "BUTTON_CLOSE";

    public static const TOP_BUTTONS_GROUP_ALL:String = "TOP_BUTTONS_GROUP_ALL";
    public static const TOP_BUTTONS_GROUP_SIMULATION:String = "TOP_BUTTONS_GROUP_SIMULATION";
    public static const TOP_BUTTONS_GROUP_INTERIOR:String = "TOP_BUTTONS_GROUP_INTERIOR";

    private var _scrollContainerPagesNum:int = 0;

    public static const TAB_SOCIAL:String = "TAB_SOCIAL";
    public static const TAB_WAREHOUSE:String = "TAB_WAREHOUSE";
    public static const TAB_SHELFS:String = "TAB_SHELFS";
    public static const TAB_PAINT_WALL:String = "TAB_PAINT_WALL";
    public static const TAB_PAINT_FLOOR:String = "TAB_PAINT_FLOOR";

    private var _currentTab:String = null;

    private static var _itemHoverFilter:ColorMatrixFilter = null

    public function BottomPanel() {
        super();
        var _skinImage:Image = GraphicFactory.getImageForRender("Interface/Skins/bottom_panel");//hint_skin
        this._panelTexture = new Scale3Textures(_skinImage.texture,_skinImage.width/2,1);
        this._panelImage = new Scale3Image(this._panelTexture);

        this._panelImage.width = DEFAULT_PANEL_WIDTH;
        this._panelImage.alignPivot("center","bottom");
        this._panelImage.useSeparateBatch = false;
        this._panelImage.touchable = false;
        //this._panelImage.flatten();
        addChild(this._panelImage);

        this._createTopButtons();
        this._createNavButtons();

        this._closeButton =  new ButtonSmall(ButtonSmall.RED_TYPE,ButtonSmall.SIGN_CROSS);
        this._closeButton.addEventListener(Event.TRIGGERED, HANDLER_closeButtonTriggered);
        this._closeButton.x = this.width/2 - 35;
        this._closeButton.y = topButtonsPositionPoint.y + 5;
        this.addChild(this._closeButton);

        //create scroll container
        this._scrollContainer = new ScrollContainer();
        var layout:HorizontalLayout = new HorizontalLayout();
        layout.gap = 2;
        this._scrollContainer.y = -5;
        //this._scrollContainer.layout = layout;
        this._scrollContainer.width = 642;
        this._scrollContainer.height = 118;
        this._scrollContainer.snapToPages = true;
        this._scrollContainer.pageWidth = 92;
        this._scrollContainer.alignPivot("center","bottom");
        this._scrollContainer.verticalScrollPolicy = ScrollContainer.SCROLL_POLICY_OFF;
        this._scrollContainer.scrollBarDisplayMode = ScrollContainer.SCROLL_BAR_DISPLAY_MODE_FIXED;
        this._scrollContainer.horizontalScrollBarFactory = function():ScrollBar{
            var scrollBar:ScrollBar = new ScrollBar();
            scrollBar.direction = ScrollBar.DIRECTION_HORIZONTAL;
            //skin the scroll bar here
            scrollBar.trackLayoutMode = ScrollBar.TRACK_LAYOUT_MODE_SINGLE;
            return scrollBar;
        }
        addChild(this._scrollContainer)
    }


    public function setTopButtonsVisibility(show:Boolean, group:String = TOP_BUTTONS_GROUP_ALL, useAnimation:Boolean = true):void {
        var i:int = 0;
        if(group == TOP_BUTTONS_GROUP_SIMULATION || group == TOP_BUTTONS_GROUP_ALL){
            for (i = 0; i < this._buttonsAsset_simulation.length; i++) {
                if(_buttonsAsset_simulation[i].visible == show){
                    continue;
                }
                _buttonsAsset_simulation[i].visible = true;
                TweenMax.to(_buttonsAsset_simulation[i], useAnimation?0.3:0, {delay:useAnimation?(0.1*i):0, y:show?"15":"-15", alpha:show?1:0,visible:show, ease:Quad.easeOut});
            }
        }
        if(group == TOP_BUTTONS_GROUP_INTERIOR || group == TOP_BUTTONS_GROUP_ALL){
            for (i = 0; i < this._buttonsAsset_interior.length; i++) {
                if(_buttonsAsset_interior[i].visible == show){
                    continue;
                }
                _buttonsAsset_interior[i].visible = true
                TweenMax.to(_buttonsAsset_interior[i], useAnimation?0.3:0, {delay:useAnimation?(0.1*i):0, y:show?"15":"-15", alpha:show?1:0,visible:show, ease:Quad.easeOut});
            }
        }
    }
    public function setCloseButtonVisibility(show:Boolean):void {
        if(show){
            this._closeButton.visible = true;
            this._closeButton.x = -this.width/2 + 25;
            this._closeButton.y = topButtonsPositionPoint.y + 5;
            this._closeButton.alpha = 0;
            TweenMax.to(this._closeButton, 0.5, {x:this.width/2 - 35,alpha:1, ease:Quad.easeOut});
        } else {
            this._closeButton.visible = false;
        }
    }

    private var _stepLeftNavButton:ButtonNavigation;
    private var _stepRightNavButton:ButtonNavigation;
    private var _rewindLeftNavButton:ButtonNavigation;
    private var _rewindRightNavButton:ButtonNavigation;
    private function _createNavButtons():void {
        this._stepLeftNavButton = new ButtonNavigation(ButtonNavigation.BUTTON_TYPE_STEP_LEFT);
        this._stepLeftNavButton.x = - this.width/2 + 45;
        this._stepLeftNavButton.y = - 80;
        this._stepLeftNavButton.addEventListener(Event.TRIGGERED, HANDLER_stepLeftTriggered);
        this.addChild(this._stepLeftNavButton);
        this._rewindLeftNavButton = new ButtonNavigation(ButtonNavigation.BUTTON_TYPE_REWIND_LEFT);
        this._rewindLeftNavButton.x = this._stepLeftNavButton.x;
        this._rewindLeftNavButton.y = - 40;
        this._rewindLeftNavButton.addEventListener(Event.TRIGGERED, HANDLER_rewindLeftTriggered);
        this.addChild(this._rewindLeftNavButton);


        this._stepRightNavButton = new ButtonNavigation(ButtonNavigation.BUTTON_TYPE_STEP_RIGHT);
        this._stepRightNavButton.x = this.width/2 - 45;
        this._stepRightNavButton.y = this._stepLeftNavButton.y;
        this._stepRightNavButton.addEventListener(Event.TRIGGERED, HANDLER_stepRightTriggered);
        this.addChild(this._stepRightNavButton);
        this._rewindRightNavButton = new ButtonNavigation(ButtonNavigation.BUTTON_TYPE_REWIND_RIGHT);
        this._rewindRightNavButton.x = this._stepRightNavButton.x;
        this._rewindRightNavButton.y = this._rewindLeftNavButton.y;
        this._rewindRightNavButton.addEventListener(Event.TRIGGERED, HANDLER_rewindRightTriggered);
        this.addChild(this._rewindRightNavButton);
    }

    public function setNavButtonsParam(param:String, value:Boolean):void {
        this._stepLeftNavButton[param] = this._stepRightNavButton[param] = this._rewindLeftNavButton[param] = this._rewindRightNavButton[param] = value;
    }
    private function HANDLER_rewindRightTriggered(event:Event):void {
        this._moveScrollContainer(this._scrollContainerPagesNum, 1);
    }
    private function HANDLER_rewindLeftTriggered(event:Event):void {
        this._moveScrollContainer(-this._scrollContainerPagesNum, 1);
    }
    private function HANDLER_stepRightTriggered(event:Event):void {
        this._moveScrollContainer(3);
    }
    private function HANDLER_stepLeftTriggered(event:Event):void {
        this._moveScrollContainer(-3);
    }
    private var _bufStepSize:int;
    private function _moveScrollContainer(stepSize:int, animationTime:Number = 0.35):void {
        this._bufStepSize = stepSize
        if(this._scrollContainer.horizontalPageIndex + stepSize > this._scrollContainerPagesNum - 7){
            if(this._scrollContainer.horizontalPageIndex < this._scrollContainerPagesNum - 7){
                stepSize = this._scrollContainerPagesNum - this._scrollContainer.horizontalPageIndex - 7;
            } else {
                stepSize = 0;
            }
        } else if(this._scrollContainer.horizontalPageIndex + stepSize < 0){
            stepSize = - this._scrollContainer.horizontalPageIndex;
        }

        if(stepSize != 0){
            TweenMax.to(this._scrollContainer,animationTime, {horizontalScrollPosition:(this._scrollContainer.horizontalPageIndex+stepSize)*this._scrollContainer.pageWidth, ease: Back.easeOut})
        } else if(this._bufStepSize < 0){
            TweenMax.to(this._scrollContainer,.25, {horizontalScrollPosition:(this._scrollContainer.horizontalPageIndex-0.5)*this._scrollContainer.pageWidth, ease: Quad.easeOut})
            TweenMax.to(this._scrollContainer,.45, {delay:0.30,horizontalScrollPosition:0, ease: Bounce.easeOut})
        } else if(this._bufStepSize > 0){
            TweenMax.to(this._scrollContainer,.25, {horizontalScrollPosition:(this._scrollContainer.horizontalPageIndex+0.5)*this._scrollContainer.pageWidth, ease: Quad.easeOut})
            TweenMax.to(this._scrollContainer,.45, {delay:0.30,horizontalScrollPosition:(this._scrollContainer.horizontalPageIndex)*this._scrollContainer.pageWidth, ease: Bounce.easeOut})
        }

// else {
//            TweenMax.to(this._scrollContainer,.25, {horizontalScrollPosition:(this._scrollContainerPagesNum+5)*this._scrollContainer.pageWidth, ease: Quad.easeOut})
//            TweenMax.to(this._scrollContainer,.45, {delay:0.30,horizontalScrollPosition:this._scrollContainer.horizontalScrollPosition - this._scrollContainer.pageWidth, ease: Bounce.easeOut})
//        }
    }



    //----------------
    //SOCIAL content
    //----------------------
    private var _socialContent:Array;
    /// [{id:"string", picture_url:"url"}, {id:"string", picture_url:""},, ...]
    public function setSocialContent(content:Array):void {
        this._socialContent = content;
        if(this._socialItems.length == 0 && this._socialContent.length > this._socialItems.length){
            for (var i:int = 0; i < this._socialContent.length; i++) {
                this._bufObject = this._socialContent[i];
                if(this._socialItems.length < i + 1){
                    this._socialItemBuf = new SocialItem(this._bufObject.id, this._bufObject.first_name,this._bufObject.installed);
                    this._socialItemBuf.alignPivot("left","top");
                    this._socialItems.push(this._socialItemBuf);
                }
            }
            if(GraphicFactory.avatarAtlas == null){
                GraphicFactory.setAvatarData(content, this._avatarsLoaded);
            }
        }
    }
    private function _avatarsLoaded():void {
        var i:int;
        for (i = 0; i < this._socialItems.length; i++) {
            this._socialItemBuf = this._socialItems[i];
            this._socialItemBuf.setAvatarImage(GraphicFactory.getAvatarImageById(this._socialItemBuf.id));
            this._socialItemBuf.showAvatar();
        }
    }
    private var _socialItems:Vector.<SocialItem> = new <SocialItem>[]
    private var _socialItemBuf:SocialItem;
    public function showSocialItems():void {
        this._currentTab = TAB_SOCIAL;

        this._scrollContainer.removeChildren();
        this._scrollContainer.horizontalScrollPosition = 0;
        this._scrollContainer.readjustLayout();

        var i:int;
        this._scrollContainerPagesNum = this._socialItems.length;
        for (i = 0; i < this._socialItems.length; i++) {
            this._socialItemBuf = this._socialItems[i];
            this._socialItemBuf.x = i*(90+2);
            //this._socialItemBuf.y = 15;
            this._scrollContainer.addChild(this._socialItemBuf);
        }
        for (i = 0; i < this._socialItems.length; i++) {
            this._socialItemBuf = this._socialItems[i];
            this._socialItemBuf.showAvatar();
        }
    }
    //--------------
    //-------------

    //----------------
    //WAREHOUSE content
    //----------------------
    private var _bufObject:Object;

    private var _warehouseItemBuf:WarehouseItem;
    private var _bufWidth:int;
    private var _bufHeight:int;

    public function showWarehouse():void {
        this._currentTab = TAB_WAREHOUSE;

        this._scrollContainer.removeChildren();
        this._scrollContainer.horizontalScrollPosition = 0;
        this._scrollContainer.readjustLayout();

        if(this._warehouseItems.length == 0){
            return;
        }

        this._bufWidth = _warehouseItems[0].width
        this._bufHeight = _warehouseItems[0].height;
        this._scrollContainerPagesNum = this._warehouseItems.length;
        for (var i:int = 0; i < _warehouseItems.length; i++) {
            this._warehouseItemBuf = _warehouseItems[i];
            this._warehouseItemBuf.x = i*(90+2) + this._bufWidth/2;
            this._warehouseItemBuf.y = this._bufHeight/2
            this._scrollContainer.addChild(this._warehouseItemBuf);
        }
    }

    //----------------
    //PAINT content
    //----------------------
    private var _floorPaintItems:Vector.<PaintItem> = new <PaintItem>[];
    private var _paintItemBuf:PaintItem;
    public function showFloorPaintItems():void {
        this._currentTab = TAB_PAINT_FLOOR;

        this._scrollContainer.removeChildren();
        this._scrollContainer.horizontalScrollPosition = 0;
        this._scrollContainer.readjustLayout();

        var i:int;

        if(this._floorPaintItems.length == 0){
            return;
        }

        this._bufWidth = _floorPaintItems[0].width
        this._bufHeight = _floorPaintItems[0].height;
        this._scrollContainerPagesNum = this._floorPaintItems.length;
        for (i = 0; i < this._floorPaintItems.length; i++) {
            this._paintItemBuf = this._floorPaintItems[i];
            this._paintItemBuf.x = i*(90+2)+ this._bufWidth/2;
            this._paintItemBuf.y = this._bufHeight/2 + 5;
            this._scrollContainer.addChild(this._paintItemBuf);
        }

        for (i = 0; i < this._floorPaintItems.length; i++) {
            this._paintItemBuf = this._floorPaintItems[i];
            this._paintItemBuf.showContentImage();
        }
    }
    private var _wallPaintItems:Vector.<PaintItem> = new <PaintItem>[];
    public function showWallPaintItems():void {
        this._currentTab = TAB_PAINT_WALL;

        this._scrollContainer.removeChildren();
        this._scrollContainer.horizontalScrollPosition = 0;
        this._scrollContainer.readjustLayout();

        var i:int;

        if(this._wallPaintItems.length == 0){
            return;
        }
        this._bufWidth = _wallPaintItems[0].width
        this._bufHeight = _wallPaintItems[0].height;
        this._scrollContainerPagesNum = this._wallPaintItems.length;
        for (i = 0; i < this._floorPaintItems.length; i++) {
            this._paintItemBuf = this._wallPaintItems[i];
            this._paintItemBuf.x = i*(90+2)+ this._bufWidth/2;
            this._paintItemBuf.y = this._bufHeight/2 + 5;
            this._scrollContainer.addChild(this._paintItemBuf);
        }
        for (i = 0; i < this._wallPaintItems.length; i++) {
            this._paintItemBuf = this._wallPaintItems[i];
            this._paintItemBuf.showContentImage();
        }
    }
    //----------------
    //SHELFS content
    //----------------------

    private var _shelfItemBuf:ShelfItem;
    private var _shelfItems:Vector.<ShelfItem> = new <ShelfItem>[];

    public function showShelfItems():void {
        this._currentTab = TAB_SHELFS;

        this._scrollContainer.removeChildren();
        this._scrollContainer.horizontalScrollPosition = 0;
        this._scrollContainer.readjustLayout();

        if(this._shelfItems.length == 0){
            return;
        }

        this._bufWidth = _shelfItems[0].width
        this._bufHeight = _shelfItems[0].height;
        this._scrollContainerPagesNum = this._shelfItems.length;
        for (var i:int = 0; i < _shelfItems.length; i++) {
            this._shelfItemBuf = _shelfItems[i];
            this._shelfItemBuf.x = i*(90+2) + this._bufWidth/2;
            this._shelfItemBuf.y = this._bufHeight/2 + 5
            this._scrollContainer.addChild(this._shelfItemBuf);
        }
    }


    //--------------
    //-------------

    private var _bufButton:Button;
    private var _positionPoint:Point = new Point()
    private function _createTopButtons():void {
       this._buttonsAsset_simulation = new <Button>[];
       this._buttonsAsset_interior = new <Button>[];

        this._positionPoint.setTo(-DEFAULT_PANEL_WIDTH/2 + 35, - this._panelImage.height - 25);
        this._bufButton = new ButtonSmall(ButtonSmall.BLUE_TYPE,ButtonSmall.SIGN_HELMET);
        this._bufButton.x = this._positionPoint.x;
        this._bufButton.y = this._positionPoint.y;
        this._bufButton.addEventListener(Event.TRIGGERED, HANDLER_interiorModeButtonTriggered);
        addChild(this._bufButton);
        this._buttonsAsset_simulation.push(this._bufButton);

        this._bufButton = new ButtonSmall(ButtonSmall.GREEN_TYPE,ButtonSmall.SIGN_OK);
        this._bufButton.x = this._positionPoint.x;
        this._bufButton.y = this._positionPoint.y;
        this._bufButton.addEventListener(Event.TRIGGERED, HANDLER_simulationModeButtonTriggered);
        addChild(this._bufButton);
        this._buttonsAsset_interior.push(this._bufButton);
        //----------------------------------------------------------------------
        this._positionPoint.offset(53,0);
        this._bufButton = new ButtonSmall(ButtonSmall.GREEN_TYPE,ButtonSmall.SIGN_SHOP_BASKET);
        this._bufButton.x = this._positionPoint.x;
        this._bufButton.y = this._positionPoint.y;
        this._bufButton.addEventListener(Event.TRIGGERED, HANDLER_shopButtonTriggered);
        addChild(this._bufButton);
        this._buttonsAsset_simulation.push(this._bufButton);

        this._bufButton = new ButtonSmall(ButtonSmall.BLUE_TYPE,ButtonSmall.SIGN_CUBE);
        this._bufButton.x = this._positionPoint.x;
        this._bufButton.y = this._positionPoint.y;
        this._bufButton.addEventListener(Event.TRIGGERED, HANDLER_buildObjectButtonTriggered);
        addChild(this._bufButton);
        this._buttonsAsset_interior.push(this._bufButton);
        //--------------------------------------------------------------------------
        this._positionPoint.offset(53,0);
        this._bufButton = new ButtonSmall(ButtonSmall.GREEN_TYPE,ButtonSmall.SIGN_ARRAY);
        this._bufButton.x = this._positionPoint.x;
        this._bufButton.y = this._positionPoint.y;
        this._bufButton.addEventListener(Event.TRIGGERED, HANDLER_warehouseButtonTriggered);
        addChild(this._bufButton);
        this._buttonsAsset_simulation.push(this._bufButton);

        this._bufButton = new ButtonSmall(ButtonSmall.BLUE_TYPE,ButtonSmall.SIGN_PAINT_FLOOR);
        this._bufButton.x = this._positionPoint.x;
        this._bufButton.y = this._positionPoint.y;
        this._bufButton.addEventListener(Event.TRIGGERED, HANDLER_paintFloorButtonTriggered);
        addChild(this._bufButton);
        this._buttonsAsset_interior.push(this._bufButton);
        //----------------------------------------------------------------------------------
        this._positionPoint.offset(53,0);
        this._bufButton = new ButtonSmall(ButtonSmall.BLUE_TYPE,ButtonSmall.SIGN_PAINT_WALL);
        this._bufButton.x = this._positionPoint.x;
        this._bufButton.y = this._positionPoint.y;
        this._bufButton.addEventListener(Event.TRIGGERED, HANDLER_paintWallButtonTriggered);
        addChild(this._bufButton);
        this._buttonsAsset_interior.push(this._bufButton);

    }


    private function HANDLER_simulationModeButtonTriggered(event:Event):void {
        this.dispatchEventWith(BottomPanel.EVENT_BUTTON_TRIGGERED,false, {buttonName:BottomPanel.BUTTON_SIMULATION});
        //this.showSocialItems();
    }

    private function HANDLER_interiorModeButtonTriggered(event:Event):void {
        this.dispatchEventWith(BottomPanel.EVENT_BUTTON_TRIGGERED,false, {buttonName:BottomPanel.BUTTON_INTERIOR});
    }
    private function HANDLER_shopButtonTriggered(event:Event):void {
        this.dispatchEventWith(BottomPanel.EVENT_BUTTON_TRIGGERED,false, {buttonName:BottomPanel.BUTTON_SHOP});
    }

    private function HANDLER_warehouseButtonTriggered(event:Event):void {
        this.dispatchEventWith(BottomPanel.EVENT_BUTTON_TRIGGERED,false, {buttonName:BottomPanel.BUTTON_WAREHOUSE});
        //this.showWarehouse();
    }

    private function HANDLER_buildObjectButtonTriggered(event:Event):void {
        this.dispatchEventWith(BottomPanel.EVENT_BUTTON_TRIGGERED,false, {buttonName:BottomPanel.BUTTON_BUILD_OBJECT});
    }

    private function HANDLER_paintFloorButtonTriggered(event:Event):void {
        this.dispatchEventWith(BottomPanel.EVENT_BUTTON_TRIGGERED,false, {buttonName:BottomPanel.BUTTON_PAINT_FLOOR});
        //this.showFloorPaintItems();
    }
    private function HANDLER_paintWallButtonTriggered(event:Event):void {
        this.dispatchEventWith(BottomPanel.EVENT_BUTTON_TRIGGERED,false, {buttonName:BottomPanel.BUTTON_PAINT_WALL});
        //this.showWallPaintItems();
    }

    private function HANDLER_closeButtonTriggered(event:Event):void {
        this.dispatchEventWith(BottomPanel.EVENT_BUTTON_TRIGGERED,false, {buttonName:BottomPanel.BUTTON_CLOSE});
    }

    public function get warehouseItems():Vector.<WarehouseItem> {
        return _warehouseItems;
    }

    public function set warehouseItems(value:Vector.<WarehouseItem>):void {
        _warehouseItems = value;
    }

    public function get scrollContainer():ScrollContainer {
        return _scrollContainer;
    }

    public function get currentTab():String {
        return _currentTab;
    }

    public function get topButtonsPositionPoint():Point {
        return _positionPoint;
    }

    public function get floorPaintItems():Vector.<PaintItem> {
        return _floorPaintItems;
    }

    public function get wallPaintItems():Vector.<PaintItem> {
        return _wallPaintItems;
    }

    public static function get itemHoverFilter():ColorMatrixFilter {
        if(_itemHoverFilter == null){
            _itemHoverFilter =  new ColorMatrixFilter();
            _itemHoverFilter.adjustBrightness(0.1);
        }
        return _itemHoverFilter;
    }

    public function get shelfItems():Vector.<ShelfItem> {
        return _shelfItems;
    }
}
}

